![]() |
FSRead |
||||
Header: | Files.h | Carbon status: | Supported | |
Reads any number of bytes from an open file.
OSErr FSRead ( SInt16 refNum, SInt32 *count, void *buffPtr );
The file reference number of the open file to read from.
On input, a pointer to the number of bytes to read; on output, a pointer to the number of bytes actually read.
A pointer to the data buffer into which the bytes are to be read. This buffer is allocated by your application and must be at least as large as the count parameter.
A result code.
Because the read operation begins at the current mark, you might want to set the mark first by calling the SetFPos function. If you try to read past the logical end-of-file, FSRead reads in all the data up to the end-of-file, moves the mark to the end-of-file, and returns eofErr as its function result. Otherwise, FSRead moves the file mark to the byte following the last byte read and returns noErr.
The low-level functions PBReadSync and PBReadAsync let you set the mark without having to call SetFPos. Also, if you want to read data in newline mode, you must use PBReadSync or PBReadAsync instead of FSRead.
Supported in Carbon. Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.
© 2000 Apple Computer, Inc. — (Last Updated 5/8/2000)